var vue = new Vue({
	el: "#app", 
	data: {
		indicatorDots: !0,
		autoplay: !1,
		interval: 5e3,
		duration: 1e3,
		imgUrl: "https://app.meijiangzi.com/static/",
		ImgBaseUrl: "https://app.meijiangzi.com/static/",
		mallId: "",
		mallList: [],
		bannerImg: [],
		hospital_id: "",
		array: "",
		evaluationList: [],
		imgArray: [],
		ticket_array: [],
		star: [],
		reference_project: [],
		iscollect: !1,
		mallname: "项目详情",
		goods_data2: [],
		system_mark: "",
		evaluationNum: "",
		ismark: !1,
		ticket_mark: !1,
		collected: !0,
		tab_arr: [],
		type: 1,
		tab_opacity: 0,
		target: "",
		promotions: "",
		isAnxinmei: !1,
		insurance_content: "",
		scrollTop: 0,
		tokenMark: !1,
		sid: "",
		translate:0,
		picWidth:750, 
		salt: 0
	},
	methods: {
		gotoWaiter: function() {
		  Jump.to(page.mine.onlineService);
		},
		getData: function(t) {
			var a = this;
			wx.showLoading({
				title: "加载中",
				mask: !0
			});
			var s = void 0;
			s = localStorage.getItem("userId") ? {
				guid: t,
			  userId: localStorage.getItem("userId")
			} : {
				guid: t,
				userId: 0
			  }, this.$http.post(baseUrl+"/api/project/getDetail", s).then(function(t) {
				wx.hideLoading();
				var s = t.data;
				if (!s.success) return wx.hideLoading(), wx.showToast({
					title: "加载失败:"+s.description,
					icon: "none",
					duration: 2e3,
					mask: !0
				}), !1;
				if(s.data && !s.data.orderCount){
					s.data.orderCount = a.salt;
				}
				  a.goods_data2 = s.data.detailPaths, a.mallList = s.data, a.mallname = s.data.name, 
				  s.data.promotions && (a.promotions = s.data.promotions), null !== s.data.logoPath && "" !== s.data.logoPath && (a.bannerImg = s.data.logoPath.split(",")), 
				s.data.insurance_content && (a.insurance_content = s.data.insurance_content, a.isAnxinmei = !0), 
				a.hospital_id = s.data.hospital_id, a.ticket_array.forEach(function(t) {
					t.end_ticket_time = new Date(1e3 * t.end_ticket_time).format("yyyy.MM.dd"), t.start_ticket_time = new Date(1e3 * t.start_ticket_time).format("yyyy.MM.dd");
				}), a.iscollect = s.data.collect, this.$http.post(baseUrl+"/api/hospital/queryDetail/" + s.data.hospitalId, {
				}).then(function(t) {
					wx.hideLoading();
					var s = t.data;
					if (!s.success) return wx.hideLoading(), wx.showToast({
						title: s.description,
						icon: "none",
						duration: 2e3,
						mask: !0
					}), !1;
					a.array = s.data;
					a.reference_project = s.data.recommand;
					a.bannersRock();
				}).catch(function(t) {
					wx.hideLoading(), wx.showToast({
						title: "网络错误，请检查网络",
						icon: "none",
						duration: 2e3,
						mask: !0
					});
				});
			}).catch(function(t) {
				wx.hideLoading(), wx.showToast({
					title: "网络错误，请检查网络",
					icon: "none",
					duration: 2e3,
					mask: !0
				});
				}), this.$http.post(baseUrl+"eval/list", {
			  projectGuid: this.mallId,
			  type: 'proj',
			  currentPage: 1,
			  pageSize: 10,
				user_id: wx.getStorageSync("user_id")
			}).then(function(t) {
				wx.hideLoading();
				var s = t.data;
				if (!s.success) return wx.hideLoading(), wx.showToast({
					title: s.description,
					icon: "none",
					duration: 2e3,
					mask: !0
				}), !1;
				a.evaluationNum = s.total, a.evaluationList = s.data.slice(0, 2), a.evaluationList.forEach(function(t) {
				  t.path ? (t.images = t.path.split(","), 
					t.images = t.images.slice(0, 3)) : t.images = [ t.images ];
				});
			}).catch(function(t) {
				wx.hideLoading(), wx.showToast({
					title: "网络错误，请检查网络",
					icon: "none",
					duration: 2e3,
					mask: !0
				});
			});
		},
		tips: function() {
			window.confirm("预约价是预约咨询本项目的价格，预约成功后，既可以优惠价享受该项目服务");
		},
		call: function() {
		  wx.showToast({
			title: "筹备中,敬请期待!",
			icon: "none",
			duration: 2e3,
			mask: !1
		  });
		},
		tobooking_detail: function() {
			login._2page();
			if(localStorage.getItem("userId")){
				Jump.to(page.index.confirm_booking, "id=" + this.mallId);	
			}
		},
		toEvaluation_detail: function(t) {
			wx.navigateTo({
				url: "/pages/evaluation_detail/main?id=" + t
			});
		},
		toProjectDetail: function(t) {
			this.getData(t.guid);
		},
		collect: function() {
			var t = this;
			login._2page();
			  wx.showLoading({
				title: "请求中...",
				mask: !0
			  });
			  var url = t.iscollect ? '/project/remove/collect' : '/project/add/collect';
			  this.$http.post(baseUrl+url, {
				productGuid: this.mallId
			  }).then(function (a) {
				wx.hideLoading();
				var s = a.data;
				s.success ? (t.iscollect ? wx.showToast({
				  title: "取消收藏",
				  icon: "none",
				  duration: 2e3,
				  mask: !1
				}) : wx.showToast({
				  title: "收藏成功",
				  icon: "none",
				  duration: 2e3,
				  mask: !1
				}), setTimeout(function () {
				  t.getData(t.mallId);
				}, 1e3)) : wx.showToast({
				  title: s.description,
				  icon: "none",
				  duration: 2e3,
				  mask: !1
				});
			  }).catch(function (t) {
				wx.hideLoading(), wx.showToast({
				  title: "网络错误，请稍后重试",
				  icon: "none",
				  duration: 2e3,
				  mask: !0
				});
			  });
		},
		toTicketDetail: function() {
			this.ismark = !0, this.ticket_mark = !0;
		},
		closeTicketBox: function() {
			this.ismark = !1, this.ticket_mark = !1;
		},
		handerScroll: function() {
			var s = srollEvent.getScrollTop();
			this.scrollTop = s, this.tab_opacity = this.scrollTop / 400, 
			this.scrollTop < 880 ? this.type = 1 : 880 < this.scrollTop && this.scrollTop < 1200 ? this.type = 3 : this.scrollTop > 1200 && (this.type = 2), 
				this.target = "" == this.target ? this.target : "";
		},
		toggleTab: function(t) {
			switch (this.type = t, this.type) {
			  case 1:
				this.target = "banner";
				break;

			  case 2:
				this.target = "evaluation";
				break;

			  default:
				this.target = "project_detail";
			}
			var element = this.$el.querySelector("#" + this.target);
			document.documentElement.scrollTop = element.offsetTop;
		},
		bannersRock:function(){
			var t = this;
			var left = new Array();
			var banners = this.bannerImg;
			banners.forEach(function(e,index){
				if(index==banners.length-1){
					return;
				}
				left.push((index+1)*t.picWidth*-1);
			});
			var right = new Array();
			var flag = true;
			setInterval(function(){
				if(flag){
					t.translate = left.shift();
					right.push(t.translate);
					if(left.length==0){
						flag =false;
					}
				}else{
					var translate = right.pop();
					t.translate = translate+t.picWidth;
					left.push(translate);
					if(right.length==0){
						flag = true;
						left.reverse();
					}
				}
			},2000)
		},
		show_torst: function() {
			wx.showToast({
				title: "推荐购买后将获得可提现积分奖励约0~",
				icon: "none",
				duration: 2e3,
				mask: !0
			});
		}
	},
	mounted: function(t) {
		window.addEventListener("scroll", this.handerScroll, {
			passive: false
		});
	},
	created: function() {
		this.mallId = URLParam.get("id");
		this.salt = URLParam.get("salt");
		this.mallId && this.getData(this.mallId), wx.getStorageSync("user_id") ? this.tokenMark = !1 : this.tokenMark = !0;
		this.tab_arr = [{
			type: 1,
			msg: "商品"
		}, {
			type: 2,
			msg: "详情"
		}, {
			type: 3,
			msg: "反馈"
		}];
	}
})